package cn.yusei.teamTribe.service;

import org.springframework.stereotype.Service;

import cn.yusei.teamTribe.constant.TextType;
import cn.yusei.teamTribe.util.StringUtil;

@Service
public class TextFilterService {

	private static final char REPLACE_CHAR = '_';
	
	private String replaceBrackets(String string)
	{
		return string.replace('<', REPLACE_CHAR).replace('>', REPLACE_CHAR);
	}
	
	public String getFilterString(String string, int textType)
	{
		if(StringUtil.haveNullOrEmpty(string))
			return string;
		String result = replaceBrackets(string);
		switch(textType)
		{
			case TextType.NICKNAME : 
				result = result.replace(" ", "");   //去掉空格
				break;
			case TextType.RELATION_REQUEST_MESSAGE :
				break;
			case TextType.POST:
				break;
			case TextType.TEAM_INFO:
				break;
			default : 
				break;
		}
		return result;
	}
	
}
